javascript scroll to element

65

js scroll to id -

// Js
document.getElementById('id').scrollIntoView();

// JQuery
$('#id')[0].scrollIntoView();

javascript scroll to element -

document.getElementById("divId").scrollIntoView();

js scroll to element -

element.scrollIntoView();
element.scrollIntoView(alignToTop); // Boolean parameter
element.scrollIntoView(scrollIntoViewOptions); // Object parameter

Comments

Submit
0 Comments